import request from '../utils/request'

// 根据id查询用户
export function getById (id) {
  return request.get(`/user/${id}`)
}

// 获取用户列表
export function getUsers (params) {
  return request.get('/user', { params: params })
}

// 添加用户
export function addUser (data) {
  return request.post('/user', data)
}

// 修改用户
export function modUser (id, data) {
  return request.put(`/user/${id}`, data)
}

// 删除用户
export function delUser (id) {
  return request.delete(`/user/${id}`)
}

// 登录并且获取token和refreshToken
export function login (data) {
  return request.post('/user/token', data)
}

// 注册
export function register (data) {
  return request.post('/user/register', data)
}
